package gongchang;

public class NokiaFactory extends Factory {//继承抽象工厂
    @Override
    public <T extends NokiaPhone> T createNokia(Class<T> clz) {//创建不同的产品
        NokiaPhone nokiaPhone = null;
        try {
            nokiaPhone = (NokiaPhone) Class.forName(clz.getName()).newInstance();//类名(ClassName)来实例化具体的类
        } catch (Exception e) {
            e.printStackTrace();
        }
        return (T) nokiaPhone;
    }
}